// JavaScript Document// JavaScript Document
tender=jQuery.noConflict();

tender().ready(function() {
	tender("#tender-node-form").validate({
		
										/* onfocusout: false,
  										 onkeyup: false,
  										 onclick: false,*/
										 //debug:true,
										 
					rules: {
						'field_ten_department[und]': { 
							required: true,
							chkbadchar:true,
							
						},
						'field_ten_organisation[und]': { 
							required: true,
							chkbadchar:true,
							valuenotequals: '_none',
						},
						'title': { 
							required: true,
							chkbadchar:true,
							
						},
						'field_ten_refno[und][0][value]':{
							required:true,	
							chkbadchar:true,
							},
						'field_ten_dipr[und][0][value]':{
							required: true,
							chkbadchar:true,
							},
						'field_ten_annosment_date[und][0][value][date]':{
							required: true,
							chkbadchar:true,
						},
						'field_ten_lastdate[und][0][value][date]':{
							//required : 'option:selected[value="5"]',
							required: true,
							chkbadchar:true,
							
						},
						'field_ten_openingdate[und][0][value][date]':{
							required: true,
							chkbadchar:true,
						},
						'field_ten_notice[und]':{
						required:true,
						chkbadchar:true,
						},
						
						'field_ten_downladable[und][0][value]':{
							required:"#edit-field-ten-notice-und-online-available:checked",
							chkbadchar:true,
							url: true,
							},
						'files[field_ten_available_und_0]':{
							required:"#edit-field-ten-notice-und-downloadble:checked",
							chkbadchar:true,
							chkfile_format_size: true,
							
						},
						'field_ten_keywordc[und][0][value]':{
							required:true,
							chkbadchar:true,
						},
						
						
						
						
					
					},
                    messages: {
						'field_ten_department[und]':{
							required: 'Please Select Concerned Department',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							
							},
							'field_ten_organisation[und]':{
							required: 'Please Select Organization',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							valuenotequals:'Please select Organisation',
							
							
							},
							'title': { 
							required:  'Please enter Title',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_refno[und][0][value]':{
							required:  'Field Value is Required',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_dipr[und][0][value]': { 
							required: 'Please Fill dipr no',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_annosment_date[und][0][value][date]':{
							required: 'Please fill announcement date',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_lastdate[und][0][value][date]':{
							required:  'Please fill last date',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_openingdate[und][0][value][date]':{
							required:'Please fill opening date',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_notice[und]':{
							required: 'Please select online available or download',
							chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							'field_ten_downladable[und][0][value]':{
								required: 'Please fill the valid URL',
								chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
								url: 'Not Valid URL',
							},
							'files[field_ten_available_und_0]':{
								required: 'Please Upload the file',
								chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
								chkfile_format_size: 'Invalid File Format',
							},
							'field_ten_keywordc[und][0][value]':{
								required:  'Please enter keywords',
								chkbadchar: 'insert, select, update, delete, drop, alter, change, modify not allowed.',
							},
							
						}, 
					//errorLabelContainer: "#errormsg_container",
					 //focusInvalid: false,
   					invalidHandler: function(form, validator) {
       
       					 if (!validator.numberOfInvalids())
								return;
						else{
							
							  //tender("#announcements-node-form").create_errormsg_container('errormsg_container','announcements-node-form');
						}
							
							tender('html, body').animate({
								scrollTop: tender(validator.errorList[0].element).offset().top - 100
							}, 1000);
							
						},
										   
	});
});


